<?php

    // TITLE: html
    // FILE: html.php
    // AUTHOR: dantira
    // CREATED: Mar 6, 2015, 11:34:29 PM

    function echoButton($class, $title, $dir, $sub, $act, $v1 = false, $v2 = false) {
	$onclick= 'godo(' . $dir . ', ' . $sub . ', ' . $act;
	if (v1) $onclick .= ', ' . $v1;
	if (v2) $onclick .= ', ' . $v2;
	$onclick .= ')';
	echo '<button class="' . $class . '" ' . $onclick . '">' . $title . '</button>';
    }

    function echoOptions($items, $target) {
	foreach  ($items as $item) {
	    $i = $item->getId();
	    $t = $item->getTitle();
	    $s = ($id == $target) ? ' selected': '';
	    echo '<option value="' . $i . '"' . $s . '>' . $t . '</option>' . "\n";
	}// end foreach items
    }// end echoOptions
    
    function echoStateSelect($id) {
	
	echo '<select id="state">';

	foreach ($states as $state) {
	    $selected = ($state->getId() == $id) ? ' selected': '';
	    echo '<option value="' . $state->getId() . '"' . $selected . '>' . $state->getAbbreviation() . '</option>' . "\n";
	    // <option value="38" selected>PA</option>
	}

	echo '</select>';

    }// end echoSelectState
    
?>